<template>
	<div class="content" style="height: 100%;">
		<scroll-view scroll-y="true" class="scroll-view" @scrolltoupper="upper" @scrolltolower="lower"
			:scroll-top='scrollTop' style="height: 100%;" @scroll="onScroll">
			<div>
				<!--参展楼盘-->
				<div class="listCon">
					<ul class="ul" style="padding: 0;" v-if="list.length>0">
						<li class="li" v-for="(item , i) in list" v-bind:key="i" @tap.stop='linkDetail(item)'>
							<div class="liWrap">
								<div class="title">
									{{item.nickname}}
									<div class="titlePeo">近期867人到店</div>
								</div>
								<div class="label">
									<div class="lab" style="background-color: #e0f3fe; color: #00a0f5;">免租30天</div>
									<div class="lab">进地铁</div>
									<div class="lab">带电梯</div>
								</div>
								<div class="address">
									<div>铁西区万达｜距离9号线沈辽路B口798米</div>
								</div>
								<div class="roomList">
									<div class="roomL">
										<div class="room" v-for="i in 7" @tap.stop='roomDetail(i)'>
											<img src="../../static/shouc.png"
												style="width: 100px; height:80px; border-radius: 8px;" alt="">
											<div class="roomName">标准温馨双床单间标准温馨双床单间</div>
											<div class="money"> <span>999</span> 元/月起</div>
										</div>
									</div>
								</div>1
							</div>

						</li>
						<div class="load" v-show="isLoadDowning == 1">
							<img class="loadImg" src="https://gateway.yijushenyang.com/static/img/loading.png" alt="">
							<span>加载中</span>
						</div>
						<div class="load" v-show="isLoadDowning == 2">
							<span>没有更多了～</span>
						</div>
					</ul>
					<div v-else style="text-align: center; font-size: 14px;">
						<img src="https://gateway.yijushenyang.com/img/none.png"
							style="margin: 0 auto; margin-top: 40px; width: 50px; height:50px;" alt="">
						<div class="" style="margin-top: 10px; color: #999;">
							暂无数据
						</div>
					</div>

				</div>
			</div>
		</scroll-view>
	</div>
</template>

<script>
	import config from '@/config.js';
	export default {
		components: {

		},
		data() {
			return {
				pageNum: 1,
				pageSize: 10,
				list: [],
				loadBottom: true,
			}
		},
		onLoad(option) {
			console.log(option)
			if (option.value) {
				this.searchValue = option.value
			}
			this.listAppFun()
			// 滚动问题
			const query = uni.createSelectorQuery().in(this);
			query.select('#editor').boundingClientRect(data => {
				console.log(data)
				this.navtop = data.top

			}).exec();
		},
		onShareAppMessage(res) { //发送给朋友
			return {
				title: '逸居盛京',
				path: '/pages/home/index',
				imageUrl: "",
			}
		},
		onShareTimeline(res) { //分享到朋友圈
			return {
				title: '逸居盛京',
				path: '/pages/home/index',
				imageUrl: "",
			}
		},
		methods: {
			linkDetail(item) {
				uni.navigateTo({
					url: '/pages/builds/detail?id=' + item.plateId
				})
			},

			upper: function(e) {
				console.log(e)

			},
			lower: function(e) {
				if (this.loadBottom) {
					this.isLoadDowning = 1
					this.pageNum += 1;
					this.listAppFun()
				} else {
					this.isLoadDowning = 2
				}
				console.log(e)
			},

			// 列表
			listAppFun() {
				var pream = {
					pageNum: this.pageNum,
					pageSize: this.pageSize,
				}

				uni.request({
					url: config.host + 'system/plate/app/listApp',
					data: pream,
					success: (res) => {
						// this.actobj = res.data.rows[0]
						for (var i = 0; i < res.data.rows.length; i++) {
							if (res.data.rows[i].label) {
								res.data.rows[i].label = res.data.rows[i].label.split(",")
							}
							if (res.data.rows[i].modelLabel) {
								res.data.rows[i].modelLabel = res.data.rows[i].modelLabel.split(",")
							}
						}
						this.list = this.list.concat(res.data.rows)
						console.log('list', this.list)
						this.isLoadDowning = 0
						if (this.list.length < res.data.total) {
							this.loadBottom = true

						} else {
							this.isLoadDowning = 2
							this.loadBottom = false
						}
						this.showNav = false
					}
				});
			},
			onScroll(e) {
				if (e.detail.scrollTop > this.navtop) {
					this.scorllBool = true
				} else {
					this.scorllBool = false
				}
				this.old.scrollTop = e.detail.scrollTop
			},

			roomDetail(i) {
				console.log(i)
				uni.navigateTo({
					url: '/pages/builds/room-detail?id=' + i
				})
			},

		}
	}
</script>

<style>
	@import '/common/css/index/index.scss';
</style>

<style lang="scss">

</style>